import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wx
 * Date: 2024-03-10
 * Time: 10:01
 */
public class IODemo1 {
    public static void main(String[] args) throws IOException {
       /* File f = new File("C:/Users/1/test.txt");
        System.out.println(f.getParent());
        System.out.println(f.getName());
        System.out.println(f.getPath());
        System.out.println(f.getAbsolutePath());
        System.out.println(f.getCanonicalPath());
        */
        //如果构造 File 对象使用绝对路径,此时上述后边三个操作,确实没有太大区别

        File f = new File("aaa/bbb/ccc/test.txt");//相对路径
        System.out.println(f.getParent());
        System.out.println(f.getName());
        System.out.println(f.getPath());  //结果和构造方法的参数一致
        System.out.println(f.getAbsolutePath());   //.表示当前的路径 (原地踏步)
        System.out.println(f.getCanonicalPath());  //针对绝对路径整理化简的效果


    }
}
